<!DOCTYPE html>
<html>
<head>
    <title>箱子管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="/css/bootstrap-responsive.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" type="text/css" href="/css/style.css">

    <link href="/js/cropper/cropper.min.css" rel="stylesheet">
    <link href="/js/cropper/main.css" rel="stylesheet">

</head>
<body style="margin:15px;">
<div id="lert"></div>
<% if (success) { %>
<div class="alert alert-success">
    <h4><%= success %></h4>
</div>
<% } %>
<% if (error) { %>
<div class="alert alert-error">
    <h4><%= error %></h4>
</div>
<% } %>
<legend>新建商品</legend>
<!--<form action="/box_management/create_buyer" style="margin-left: 25%" onsubmit="return check()" method="post" name="form3" class="form-horizontal">-->

<div class="container" id="crop-avatar">

    <!-- Current avatar -->

    <div style="text-align: center;margin-top: 20px;margin-bottom: 20px">

        <img src="/images/prize.png" class="avatar-view" style="width: 150px;height: 150px;border: 1px solid #ABABAB;" alt="...">
    </div>
    <form action="/box_management/create_prize" style="margin-left: 25%" onsubmit="return check()" method="post" name="form3" class="form-horizontal">

        <div class="control-group">
            <label class="control-label">商品名称：</label>
            <div class="controls">
                <input type="text" id="name" name="name" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">商品价格：</label>
            <div class="controls">
                <input type="text" id="price" name="price" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">商品链接：</label>
            <div class="controls">
                <input type="text" id="taobao_url" name="taobao_url" />
                <input type="text" id="imgurl" name="imgurl" value="" style="display: none"/>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">微信商品ID：</label>
            <div class="controls">
                <input type="text" id="wechat_productId" name="wechat_productId" />
            </div>
        </div>

        <div class="control-group">
            <div class="controls">
                <input type="submit" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" id="sub_btn">
            </div>
        </div>
    </form>

    <!-- Cropping modal -->
    <div class="modal fade" id="avatar-modal" aria-hidden="true" aria-labelledby="avatar-modal-label" role="dialog" tabindex="-1">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <form class="avatar-form" action="/box_management/uploadimg" enctype="multipart/form-data" method="post">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal" type="button">&times;</button>
                        <h4 class="modal-title" id="avatar-modal-label">裁剪图片</h4>
                    </div>
                    <div class="modal-body">
                        <div class="avatar-body">

                            <!-- Upload image and data -->
                            <div class="avatar-upload">
                                <input class="avatar-src" name="avatar_src" type="hidden">
                                <input class="avatar-data" name="avatar_data" type="hidden">
                                <input class="avatar-input" id="avatarInput" name="avatar_file" style="margin-left: 0;line-height: 0px;" type="file">
                                <button style="float: right" type="submit">上传</button>
                            </div>

                            <!-- Crop and preview -->
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="avatar-wrapper"></div>
                                </div>
                                <!--<div class="col-md-3">-->
                                    <!--<div class="avatar-preview preview-lg"></div>-->
                                    <!--<div class="avatar-preview preview-md"></div>-->
                                    <!--<div class="avatar-preview preview-sm"></div>-->
                                <!--</div>-->
                            </div>


                        </div>
                    </div>
                    <!-- <div class="modal-footer">
                      <button class="btn btn-default" data-dismiss="modal" type="button">Close</button>
                    </div> -->
                </form>
            </div>
        </div>
    </div><!-- /.modal -->

    <!-- Loading state -->
    <div class="loading" aria-label="Loading" role="img" tabindex="-1"></div>
</div>

<script src="/lib/jq/jquery-1.11.2.min.js"></script>
<script src="/lib/jq/bootstrap.min.js"></script>
<script src="/js/cropper/cropper.min.js"></script>
<script src="/js/cropper/main.js"></script>
<script>
    function check(){
        var imgurl=$('#imgurl').val();
        var name=$('#name').val();
        var price=$('#price').val();
        var taobao_url=$('#taobao_url').val();
        var wechat_productId=$('#wechat_productId').val();
        if(imgurl==''||name==''||price==''||taobao_url==''||wechat_productId==''){
            $('#lert').html("<div class='alert alert-error'><h4>请完善资料.</h4></div>");
            return false;
        }else{
            return true;
        }

    }

</script>

</body>
</html>